<?php

namespace app\home\controller\order;

use app\common\model\Video;
use app\common\model\VideoVipLevel as models;
use app\common\traites\PublicCrudTrait;
use app\home\controller\Base;

class Order extends Base
{
    protected $model;
    protected $home_user;
    use PublicCrudTrait;

    /**
     * 个人中心
     */
    public function initialize()
    {
        $this->home_user = session('home_user');
        //判断不存在时直接 return出去
        $this->model = new models();
        parent::initialize(); // TODO: Change the autogenerated stub
    }

    //获取套餐
    public function level()
    {
        $list = $this->model->where('status', 1)->select();
        return show($list);
    }

    //视频播放 获取当前视频
    public function video()
    {
        $id=$this->request->post('id',0);
        if ($id <=0 ) return show([],config('ToConfig.http_code.error'),'视频错误');
        $find = (new Video())->find($id);
        if (empty($find)) return show([],config('ToConfig.http_code.error'),'没有该视频');
        return show($find);
    }


}